<?php
$this->placeholder("navegacion")->set($this->navegacion($this->nav));

$domConfig = Zend_Registry::get('domConfig');
$perfil = App_Perfil::getInstance();
$perfil->cargar("VARIABLES");
if ($perfil->crear()){
?>
<div align="right" class="buttons">
  <a class="btn btn-primary" href="<?php echo $this->baseUrl("/variables/index/crearvariable");?>">
  <span class="glyphicon glyphicon-plus-sign"></span> Crear Variable</a>
</div>
<?php }
if(count($this->datos)>0):?>
<table id="table_id" align="center" class="display">
  <thead>
    <tr>
      <th width="10%">C&oacute;digo</th>
      <th width="20%">Nombre variable</th>
      <th width="20%">Descripci&oacute;n</th>
      <th width="10%">Tipo naturaleza</th>
      <th width="10%">Tipo grado</th>
      <th width="15%">Acciones</th>
    </tr>
  </thead>
  <tbody>
	<?php foreach ($this->datos as $key => $value):?>
    <tr>
      <td><?php echo $value["idvariable"];?></td>
      <td><?php echo $value["nombrevariable"];?></td>
      <td><?php echo "{$value["descripcion"]}";?></td>
	  <td><?php echo $domConfig->TIPONATURALEZA->$value["tiponaturaleza"];?></td>
	  <td><?php echo $domConfig->TIPOGRADO->$value["tipogrado"];?></td>
      <td>
        <?php
        $params=App_Util_SafeUrl::encriptar(array("codvariable"=>$value["codvariable"]),true);
        $tools = new App_Util_ToolButton();
        $tools->addEdit($this->baseUrl("/variables/index/crearvariable/{$params}"),$perfil->modificar());
//        $tools->add($this->baseUrl("/variables/index/actividadesplan/{$params}"), "Actividades plan", "glyphicon glyphicon-list-alt", $perfil->cargar("ADMIN_PLANES1"));
//        $tools->add($this->baseUrl("/variables/index/usuariosvariable/{$params}"), "Asignar responsables", "glyphicon glyphicon-user", $perfil->cargar("#ADMIN_PLANES2"));
        if ($perfil->eliminar()){
            $tools->addDelete($this->baseUrl("/variables/index/eliminarvariable/{$params}"),true);
        }
        echo $tools->render();
   		?>
      </td>
    </tr>
  <?php  endforeach;?>
  </tbody>
</table>

<script type="text/javascript">
 $(function() {
	$('#table_id').dataTable({
		"bJQueryUI": true,
		"bAutoWidth": false,
 		"sPaginationType": "full_numbers",
 		"bStateSave": true,
 		"aoColumns": [
 	 		 			{ "sType": "numeric" },
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			{ "bSortable": false, "bSearchable": false }
 	 		 		 ]
 	 		  		
	});

});
</script>
<?php else:?>
<br/>
<?php echo $this->mensajes("No existen registros");?>
<?php endif;?>
